// Demonstrate casting.
class CastDemo { 
    public static void main(String args[]) {
        double x, y;
        int i;
        byte b;
        char ch;

        x = 10.0;
        y = 3.0;

        i = (int) (x / y); // cast double into int
        System.out.println("Integer outcome of x / y: " + i);

        i = 100;
        b = (byte) i; // no loss of info here
        System.out.println("Value of b: " + b);

        i = 257; 
        b = (byte) i; // loss of info here. Byte cannot hold 257.
        System.out.println("Value of b: " + b);

        b = 88; // ASCII code for X
        ch = (char) b;
        System.out.println("ch: " + ch);
    }
}


